module.exports = app => {
    //  全局變量
    app.use(async (ctx,next) =>{
        ctx.state={
            userName: '张三',
            menu: [
                {
                    id: 1,
                    title: '生活故事',
                    icon: 'chart bar outline'
                },
                {
                    id: 2,
                    title: '新闻曝光',
                    icon: 'newspaper outline'
                },
                {
                    id: 3,
                    title: '游戏竞技',
                    icon: 'gamepad'
                },
                {
                    id: 4,
                    title: '社区交友',
                    icon: 'street view'
                }
            ]
        }
        await next()
    })
    //  路由註冊
    app.use(require('../routes/demo/index').routes())
}
